/*
'===============================================================================
'  Generated From - CSharp_EasyObject_BusinessEntity.vbgen
' 
'  ** IMPORTANT  ** 
'  How to Generate your stored procedures:
' 
'  SQL      = SQL_DAAB_StoredProcs.vbgen
'  
'  This object is 'abstract' which means you need to inherit from it to be able
'  to instantiate it.  This is very easily done. You can override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  public class YourObject :  _YourObject
'  {
'
'  }
'
'===============================================================================
*/

// Generated by MyGeneration Version # (1.3.0.3)

using System;
using System.Data;
using System.Data.Common;
using System.Configuration;
using System.Collections;
using System.Collections.Specialized;
using System.Xml;
using System.IO;

using Microsoft.Practices.EnterpriseLibrary.Data;
using NCI.EasyObjects;

namespace CMS.DAL
{

	#region Schema

	public class NewsSchema : NCI.EasyObjects.Schema
	{
		private static ArrayList _entries;
		public static SchemaItem NewsID = new SchemaItem("NewsID", DbType.Int32, true, false, false, true, false, false);
		public static SchemaItem NewsTitle1 = new SchemaItem("NewsTitle1", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);
		public static SchemaItem NewsTitle2 = new SchemaItem("NewsTitle2", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);
		public static SchemaItem NewsTitle3 = new SchemaItem("NewsTitle3", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);
		public static SchemaItem NewsCategoryID = new SchemaItem("NewsCategoryID", DbType.Int32, false, false, false, false, false, false);
		public static SchemaItem Image = new SchemaItem("Image", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);
		public static SchemaItem MainContent1 = new SchemaItem("MainContent1", DbType.String, SchemaItemJustify.None, 1073741823, true, false, false, false);
		public static SchemaItem MainContent2 = new SchemaItem("MainContent2", DbType.String, SchemaItemJustify.None, 1073741823, true, false, false, false);
		public static SchemaItem MainContent3 = new SchemaItem("MainContent3", DbType.String, SchemaItemJustify.None, 1073741823, true, false, false, false);
		public static SchemaItem InitContent1 = new SchemaItem("InitContent1", DbType.String, SchemaItemJustify.None, 2000, true, false, false, false);
		public static SchemaItem InitContent2 = new SchemaItem("InitContent2", DbType.String, SchemaItemJustify.None, 2000, true, false, false, false);
		public static SchemaItem InitContent3 = new SchemaItem("InitContent3", DbType.String, SchemaItemJustify.None, 2000, true, false, false, false);
		public static SchemaItem CreatedDate = new SchemaItem("CreatedDate", DbType.Int32, false, false, false, false, false, false);
		public static SchemaItem Status = new SchemaItem("Status", DbType.Int32, false, false, false, false, false, false);
		public static SchemaItem Source = new SchemaItem("Source", DbType.String, SchemaItemJustify.None, 255, true, false, false, false);
		public static SchemaItem Priority = new SchemaItem("Priority", DbType.Int32, false, false, false, false, false, false);
		public static SchemaItem Author = new SchemaItem("Author", DbType.String, SchemaItemJustify.None, 250, true, false, false, false);

		public override ArrayList SchemaEntries
		{
			get
			{
				if (_entries == null )
				{
					_entries = new ArrayList();
					_entries.Add(NewsSchema.NewsID);
					_entries.Add(NewsSchema.NewsTitle1);
					_entries.Add(NewsSchema.NewsTitle2);
					_entries.Add(NewsSchema.NewsTitle3);
					_entries.Add(NewsSchema.NewsCategoryID);
					_entries.Add(NewsSchema.Image);
					_entries.Add(NewsSchema.MainContent1);
					_entries.Add(NewsSchema.MainContent2);
					_entries.Add(NewsSchema.MainContent3);
					_entries.Add(NewsSchema.InitContent1);
					_entries.Add(NewsSchema.InitContent2);
					_entries.Add(NewsSchema.InitContent3);
					_entries.Add(NewsSchema.CreatedDate);
					_entries.Add(NewsSchema.Status);
					_entries.Add(NewsSchema.Source);
					_entries.Add(NewsSchema.Priority);
					_entries.Add(NewsSchema.Author);
				}
				return _entries;
			}
		}
		
		public static bool HasAutoKey 
		{
			get { return true;	}
		}

		public static bool HasRowID 
		{
			get { return false;	}
		}
	}
	#endregion

	public abstract class _News : EasyObject
	{

		public _News()
		{
			NewsSchema _schema = new NewsSchema();
			this.SchemaEntries = _schema.SchemaEntries;
			this.SchemaGlobal = "dbo";
		}
		
		public override void FlushData() 	 
		{ 	 
			this._whereClause = null; 	 
			this._aggregateClause = null; 	 
			base.FlushData(); 	 
		}
			   
		/// <summary>
		/// Loads the business object with info from the database, based on the requested primary key.
		/// </summary>
		/// <param name="NewsID"></param>
		/// <returns>A Boolean indicating success or failure of the query</returns>
		public bool LoadByPrimaryKey(int NewsID)
		{
			switch(this.DefaultCommandType)
			{
				case CommandType.StoredProcedure:
					ListDictionary parameters = new ListDictionary();

					// Add in parameters
					parameters.Add(NewsSchema.NewsID.FieldName, NewsID);

					return base.LoadFromSql(this.SchemaStoredProcedureWithSeparator + "sp_GetNews", parameters, CommandType.StoredProcedure);

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					this.Where.NewsID.Value = NewsID;
					return this.Query.Load();

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}
	
		/// <summary>
		/// Loads all records from the table.
		/// </summary>
		/// <returns>A Boolean indicating success or failure of the query</returns>
		public bool LoadAll()
		{
			switch(this.DefaultCommandType)
			{
				case CommandType.StoredProcedure:
					return base.LoadFromSql(this.SchemaStoredProcedureWithSeparator + "sp_GetAllNews", null, CommandType.StoredProcedure);

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					return this.Query.Load();

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		/// <summary>
		/// Adds a new record to the internal table.
		/// </summary>
		public override void AddNew()
		{
			base.AddNew();
			this.ApplyDefaults();
		}

		/// <summary>
		/// Apply any default values to columns
		/// </summary>
		protected override void ApplyDefaults()
		{
		}

		protected override DbCommand GetInsertCommand(CommandType commandType)
		{	
			DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_AddNews";
					dbCommand = db.GetStoredProcCommand(sqlCommand);

					db.AddParameter(dbCommand, "NewsID", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, "NewsID", DataRowVersion.Default, Convert.DBNull);
					CreateParameters(db, dbCommand);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					foreach(SchemaItem item in this.SchemaEntries)
					{
						if (!item.IsComputed)
						{
							if ((item.IsAutoKey && this.IdentityInsert) || !item.IsAutoKey)
							{
								this.Query.AddInsertColumn(item);
							}
						}
					}
					dbCommand = this.Query.GetInsertCommandWrapper();

					dbCommand.Parameters.Clear();
					if (this.IdentityInsert)
					{
						db.AddInParameter(dbCommand, "NewsID", DbType.Int32, "NewsID", DataRowVersion.Default);
					}
					else
					{
						db.AddParameter(dbCommand, "NewsID", DbType.Int32, 0, ParameterDirection.Output, true, 0, 0, "NewsID", DataRowVersion.Default, Convert.DBNull);
					}
					CreateParameters(db, dbCommand);

					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		protected override DbCommand GetUpdateCommand(CommandType commandType)
		{
            DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_UpdateNews";
					dbCommand = db.GetStoredProcCommand(sqlCommand);

					db.AddInParameter(dbCommand, "NewsID", DbType.Int32, "NewsID", DataRowVersion.Current);
					CreateParameters(db, dbCommand);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					foreach(SchemaItem item in this.SchemaEntries)
					{
						if (!(item.IsAutoKey || item.IsComputed))
						{
							this.Query.AddUpdateColumn(item);
						}
					}

					this.Where.WhereClauseReset();
					this.Where.NewsID.Operator = WhereParameter.Operand.Equal;
					dbCommand = this.Query.GetUpdateCommandWrapper();

					dbCommand.Parameters.Clear();
					CreateParameters(db, dbCommand);
					db.AddInParameter(dbCommand, "NewsID", DbType.Int32, "NewsID", DataRowVersion.Current);
					
					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		protected override DbCommand GetDeleteCommand(CommandType commandType)
		{
            DbCommand dbCommand;

			// Create the Database object, using the default database service. The
			// default database service is determined through configuration.
			Database db = GetDatabase();

			switch(commandType)
			{
				case CommandType.StoredProcedure:
					string sqlCommand = this.SchemaStoredProcedureWithSeparator + "sp_DeleteNews";
					dbCommand = db.GetStoredProcCommand(sqlCommand);
					db.AddInParameter(dbCommand, "NewsID", DbType.Int32, "NewsID", DataRowVersion.Current);
					
					return dbCommand;

				case CommandType.Text:
					this.Query.ClearAll();
					this.Where.WhereClauseReset();
					this.Where.NewsID.Operator = WhereParameter.Operand.Equal;
					dbCommand = this.Query.GetDeleteCommandWrapper();

					dbCommand.Parameters.Clear();
					db.AddInParameter(dbCommand, "NewsID", DbType.Int32, "NewsID", DataRowVersion.Current);
					
					return dbCommand;

				default:
					throw new ArgumentException("Invalid CommandType", "commandType");
			}
		}

		private void CreateParameters(Database db, DbCommand dbCommand)
		{
			db.AddInParameter(dbCommand, "NewsTitle1", DbType.String, "NewsTitle1", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "NewsTitle2", DbType.String, "NewsTitle2", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "NewsTitle3", DbType.String, "NewsTitle3", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "NewsCategoryID", DbType.Int32, "NewsCategoryID", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Image", DbType.String, "Image", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "MainContent1", DbType.String, "MainContent1", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "MainContent2", DbType.String, "MainContent2", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "MainContent3", DbType.String, "MainContent3", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "InitContent1", DbType.String, "InitContent1", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "InitContent2", DbType.String, "InitContent2", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "InitContent3", DbType.String, "InitContent3", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "CreatedDate", DbType.Int32, "CreatedDate", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Status", DbType.Int32, "Status", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Source", DbType.String, "Source", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Priority", DbType.Int32, "Priority", DataRowVersion.Current);
			db.AddInParameter(dbCommand, "Author", DbType.String, "Author", DataRowVersion.Current);
		}
		
		#region Properties
		public virtual int NewsID
		{
			get
			{
				return this.GetInteger(NewsSchema.NewsID.FieldName);
	    	}
			set
			{
				this.SetInteger(NewsSchema.NewsID.FieldName, value);
			}
		}
		public virtual string NewsTitle1
		{
			get
			{
				return this.GetString(NewsSchema.NewsTitle1.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.NewsTitle1.FieldName, value);
			}
		}
		public virtual string NewsTitle2
		{
			get
			{
				return this.GetString(NewsSchema.NewsTitle2.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.NewsTitle2.FieldName, value);
			}
		}
		public virtual string NewsTitle3
		{
			get
			{
				return this.GetString(NewsSchema.NewsTitle3.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.NewsTitle3.FieldName, value);
			}
		}
		public virtual int NewsCategoryID
		{
			get
			{
				return this.GetInteger(NewsSchema.NewsCategoryID.FieldName);
	    	}
			set
			{
				this.SetInteger(NewsSchema.NewsCategoryID.FieldName, value);
			}
		}
		public virtual string Image
		{
			get
			{
				return this.GetString(NewsSchema.Image.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.Image.FieldName, value);
			}
		}
		public virtual string MainContent1
		{
			get
			{
				return this.GetString(NewsSchema.MainContent1.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.MainContent1.FieldName, value);
			}
		}
		public virtual string MainContent2
		{
			get
			{
				return this.GetString(NewsSchema.MainContent2.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.MainContent2.FieldName, value);
			}
		}
		public virtual string MainContent3
		{
			get
			{
				return this.GetString(NewsSchema.MainContent3.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.MainContent3.FieldName, value);
			}
		}
		public virtual string InitContent1
		{
			get
			{
				return this.GetString(NewsSchema.InitContent1.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.InitContent1.FieldName, value);
			}
		}
		public virtual string InitContent2
		{
			get
			{
				return this.GetString(NewsSchema.InitContent2.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.InitContent2.FieldName, value);
			}
		}
		public virtual string InitContent3
		{
			get
			{
				return this.GetString(NewsSchema.InitContent3.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.InitContent3.FieldName, value);
			}
		}
		public virtual int CreatedDate
		{
			get
			{
				return this.GetInteger(NewsSchema.CreatedDate.FieldName);
	    	}
			set
			{
				this.SetInteger(NewsSchema.CreatedDate.FieldName, value);
			}
		}
		public virtual int Status
		{
			get
			{
				return this.GetInteger(NewsSchema.Status.FieldName);
	    	}
			set
			{
				this.SetInteger(NewsSchema.Status.FieldName, value);
			}
		}
		public virtual string Source
		{
			get
			{
				return this.GetString(NewsSchema.Source.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.Source.FieldName, value);
			}
		}
		public virtual int Priority
		{
			get
			{
				return this.GetInteger(NewsSchema.Priority.FieldName);
	    	}
			set
			{
				this.SetInteger(NewsSchema.Priority.FieldName, value);
			}
		}
		public virtual string Author
		{
			get
			{
				return this.GetString(NewsSchema.Author.FieldName);
	    	}
			set
			{
				this.SetString(NewsSchema.Author.FieldName, value);
			}
		}

		public override string TableName
		{
			get { return "News"; }
		}
		
		#endregion		
		
		#region String Properties
		public virtual string s_NewsID
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.NewsID.FieldName) ? string.Empty : base.GetIntegerAsString(NewsSchema.NewsID.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.NewsID.FieldName);
			    else
			        this.NewsID = base.SetIntegerAsString(NewsSchema.NewsID.FieldName, value);
			}
		}
		public virtual string s_NewsTitle1
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.NewsTitle1.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.NewsTitle1.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.NewsTitle1.FieldName);
			    else
			        this.NewsTitle1 = base.SetStringAsString(NewsSchema.NewsTitle1.FieldName, value);
			}
		}
		public virtual string s_NewsTitle2
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.NewsTitle2.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.NewsTitle2.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.NewsTitle2.FieldName);
			    else
			        this.NewsTitle2 = base.SetStringAsString(NewsSchema.NewsTitle2.FieldName, value);
			}
		}
		public virtual string s_NewsTitle3
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.NewsTitle3.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.NewsTitle3.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.NewsTitle3.FieldName);
			    else
			        this.NewsTitle3 = base.SetStringAsString(NewsSchema.NewsTitle3.FieldName, value);
			}
		}
		public virtual string s_NewsCategoryID
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.NewsCategoryID.FieldName) ? string.Empty : base.GetIntegerAsString(NewsSchema.NewsCategoryID.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.NewsCategoryID.FieldName);
			    else
			        this.NewsCategoryID = base.SetIntegerAsString(NewsSchema.NewsCategoryID.FieldName, value);
			}
		}
		public virtual string s_Image
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.Image.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.Image.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.Image.FieldName);
			    else
			        this.Image = base.SetStringAsString(NewsSchema.Image.FieldName, value);
			}
		}
		public virtual string s_MainContent1
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.MainContent1.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.MainContent1.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.MainContent1.FieldName);
			    else
			        this.MainContent1 = base.SetStringAsString(NewsSchema.MainContent1.FieldName, value);
			}
		}
		public virtual string s_MainContent2
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.MainContent2.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.MainContent2.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.MainContent2.FieldName);
			    else
			        this.MainContent2 = base.SetStringAsString(NewsSchema.MainContent2.FieldName, value);
			}
		}
		public virtual string s_MainContent3
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.MainContent3.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.MainContent3.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.MainContent3.FieldName);
			    else
			        this.MainContent3 = base.SetStringAsString(NewsSchema.MainContent3.FieldName, value);
			}
		}
		public virtual string s_InitContent1
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.InitContent1.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.InitContent1.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.InitContent1.FieldName);
			    else
			        this.InitContent1 = base.SetStringAsString(NewsSchema.InitContent1.FieldName, value);
			}
		}
		public virtual string s_InitContent2
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.InitContent2.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.InitContent2.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.InitContent2.FieldName);
			    else
			        this.InitContent2 = base.SetStringAsString(NewsSchema.InitContent2.FieldName, value);
			}
		}
		public virtual string s_InitContent3
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.InitContent3.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.InitContent3.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.InitContent3.FieldName);
			    else
			        this.InitContent3 = base.SetStringAsString(NewsSchema.InitContent3.FieldName, value);
			}
		}
		public virtual string s_CreatedDate
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.CreatedDate.FieldName) ? string.Empty : base.GetIntegerAsString(NewsSchema.CreatedDate.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.CreatedDate.FieldName);
			    else
			        this.CreatedDate = base.SetIntegerAsString(NewsSchema.CreatedDate.FieldName, value);
			}
		}
		public virtual string s_Status
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.Status.FieldName) ? string.Empty : base.GetIntegerAsString(NewsSchema.Status.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.Status.FieldName);
			    else
			        this.Status = base.SetIntegerAsString(NewsSchema.Status.FieldName, value);
			}
		}
		public virtual string s_Source
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.Source.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.Source.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.Source.FieldName);
			    else
			        this.Source = base.SetStringAsString(NewsSchema.Source.FieldName, value);
			}
		}
		public virtual string s_Priority
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.Priority.FieldName) ? string.Empty : base.GetIntegerAsString(NewsSchema.Priority.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.Priority.FieldName);
			    else
			        this.Priority = base.SetIntegerAsString(NewsSchema.Priority.FieldName, value);
			}
		}
		public virtual string s_Author
		{
			get
			{
			    return this.IsColumnNull(NewsSchema.Author.FieldName) ? string.Empty : base.GetStringAsString(NewsSchema.Author.FieldName);
			}
			set
			{
			    if(string.Empty == value)
			        this.SetColumnNull(NewsSchema.Author.FieldName);
			    else
			        this.Author = base.SetStringAsString(NewsSchema.Author.FieldName, value);
			}
		}
		#endregion		
	
		#region Where Clause
		public class WhereClause
		{
			public WhereClause(EasyObject entity)
			{
				this._entity = entity;
			}
			
			public TearOffWhereParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffWhereParameter(this);
					}

					return _tearOff;
				}
			}

			#region TearOff's
			public class TearOffWhereParameter
			{
				public TearOffWhereParameter(WhereClause clause)
				{
					this._clause = clause;
				}
				
				
				public WhereParameter NewsID
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.NewsID);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter NewsTitle1
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.NewsTitle1);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter NewsTitle2
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.NewsTitle2);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter NewsTitle3
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.NewsTitle3);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter NewsCategoryID
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.NewsCategoryID);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Image
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.Image);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter MainContent1
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.MainContent1);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter MainContent2
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.MainContent2);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter MainContent3
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.MainContent3);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter InitContent1
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.InitContent1);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter InitContent2
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.InitContent2);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter InitContent3
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.InitContent3);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter CreatedDate
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.CreatedDate);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Status
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.Status);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Source
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.Source);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Priority
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.Priority);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}

				public WhereParameter Author
				{
					get
					{
							WhereParameter wp = new WhereParameter(NewsSchema.Author);
							this._clause._entity.Query.AddWhereParameter(wp);
							return wp;
					}
				}


				private WhereClause _clause;
			}
			#endregion
		
			public WhereParameter NewsID
		    {
				get
		        {
					if(_NewsID_W == null)
	        	    {
						_NewsID_W = TearOff.NewsID;
					}
					return _NewsID_W;
				}
			}

			public WhereParameter NewsTitle1
		    {
				get
		        {
					if(_NewsTitle1_W == null)
	        	    {
						_NewsTitle1_W = TearOff.NewsTitle1;
					}
					return _NewsTitle1_W;
				}
			}

			public WhereParameter NewsTitle2
		    {
				get
		        {
					if(_NewsTitle2_W == null)
	        	    {
						_NewsTitle2_W = TearOff.NewsTitle2;
					}
					return _NewsTitle2_W;
				}
			}

			public WhereParameter NewsTitle3
		    {
				get
		        {
					if(_NewsTitle3_W == null)
	        	    {
						_NewsTitle3_W = TearOff.NewsTitle3;
					}
					return _NewsTitle3_W;
				}
			}

			public WhereParameter NewsCategoryID
		    {
				get
		        {
					if(_NewsCategoryID_W == null)
	        	    {
						_NewsCategoryID_W = TearOff.NewsCategoryID;
					}
					return _NewsCategoryID_W;
				}
			}

			public WhereParameter Image
		    {
				get
		        {
					if(_Image_W == null)
	        	    {
						_Image_W = TearOff.Image;
					}
					return _Image_W;
				}
			}

			public WhereParameter MainContent1
		    {
				get
		        {
					if(_MainContent1_W == null)
	        	    {
						_MainContent1_W = TearOff.MainContent1;
					}
					return _MainContent1_W;
				}
			}

			public WhereParameter MainContent2
		    {
				get
		        {
					if(_MainContent2_W == null)
	        	    {
						_MainContent2_W = TearOff.MainContent2;
					}
					return _MainContent2_W;
				}
			}

			public WhereParameter MainContent3
		    {
				get
		        {
					if(_MainContent3_W == null)
	        	    {
						_MainContent3_W = TearOff.MainContent3;
					}
					return _MainContent3_W;
				}
			}

			public WhereParameter InitContent1
		    {
				get
		        {
					if(_InitContent1_W == null)
	        	    {
						_InitContent1_W = TearOff.InitContent1;
					}
					return _InitContent1_W;
				}
			}

			public WhereParameter InitContent2
		    {
				get
		        {
					if(_InitContent2_W == null)
	        	    {
						_InitContent2_W = TearOff.InitContent2;
					}
					return _InitContent2_W;
				}
			}

			public WhereParameter InitContent3
		    {
				get
		        {
					if(_InitContent3_W == null)
	        	    {
						_InitContent3_W = TearOff.InitContent3;
					}
					return _InitContent3_W;
				}
			}

			public WhereParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public WhereParameter Status
		    {
				get
		        {
					if(_Status_W == null)
	        	    {
						_Status_W = TearOff.Status;
					}
					return _Status_W;
				}
			}

			public WhereParameter Source
		    {
				get
		        {
					if(_Source_W == null)
	        	    {
						_Source_W = TearOff.Source;
					}
					return _Source_W;
				}
			}

			public WhereParameter Priority
		    {
				get
		        {
					if(_Priority_W == null)
	        	    {
						_Priority_W = TearOff.Priority;
					}
					return _Priority_W;
				}
			}

			public WhereParameter Author
		    {
				get
		        {
					if(_Author_W == null)
	        	    {
						_Author_W = TearOff.Author;
					}
					return _Author_W;
				}
			}

			private WhereParameter _NewsID_W = null;
			private WhereParameter _NewsTitle1_W = null;
			private WhereParameter _NewsTitle2_W = null;
			private WhereParameter _NewsTitle3_W = null;
			private WhereParameter _NewsCategoryID_W = null;
			private WhereParameter _Image_W = null;
			private WhereParameter _MainContent1_W = null;
			private WhereParameter _MainContent2_W = null;
			private WhereParameter _MainContent3_W = null;
			private WhereParameter _InitContent1_W = null;
			private WhereParameter _InitContent2_W = null;
			private WhereParameter _InitContent3_W = null;
			private WhereParameter _CreatedDate_W = null;
			private WhereParameter _Status_W = null;
			private WhereParameter _Source_W = null;
			private WhereParameter _Priority_W = null;
			private WhereParameter _Author_W = null;

			public void WhereClauseReset()
			{
				_NewsID_W = null;
				_NewsTitle1_W = null;
				_NewsTitle2_W = null;
				_NewsTitle3_W = null;
				_NewsCategoryID_W = null;
				_Image_W = null;
				_MainContent1_W = null;
				_MainContent2_W = null;
				_MainContent3_W = null;
				_InitContent1_W = null;
				_InitContent2_W = null;
				_InitContent3_W = null;
				_CreatedDate_W = null;
				_Status_W = null;
				_Source_W = null;
				_Priority_W = null;
				_Author_W = null;

				this._entity.Query.FlushWhereParameters();

			}
	
			private EasyObject _entity;
			private TearOffWhereParameter _tearOff;
			
		}
	
		public WhereClause Where
		{
			get
			{
				if(_whereClause == null)
				{
					_whereClause = new WhereClause(this);
				}
		
				return _whereClause;
			}
		}
		
		private WhereClause _whereClause = null;	
		#endregion
		
		#region Aggregate Clause
		public class AggregateClause
		{
			public AggregateClause(EasyObject entity)
			{
				this._entity = entity;
			}
			
			public TearOffAggregateParameter TearOff
			{
				get
				{
					if(_tearOff == null)
					{
						_tearOff = new TearOffAggregateParameter(this);
					}

					return _tearOff;
				}
			}

			#region TearOff's
			public class TearOffAggregateParameter
			{
				public TearOffAggregateParameter(AggregateClause clause)
				{
					this._clause = clause;
				}
				
				
				public AggregateParameter NewsID
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.NewsID);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter NewsTitle1
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.NewsTitle1);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter NewsTitle2
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.NewsTitle2);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter NewsTitle3
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.NewsTitle3);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter NewsCategoryID
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.NewsCategoryID);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Image
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.Image);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter MainContent1
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.MainContent1);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter MainContent2
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.MainContent2);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter MainContent3
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.MainContent3);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter InitContent1
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.InitContent1);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter InitContent2
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.InitContent2);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter InitContent3
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.InitContent3);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter CreatedDate
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.CreatedDate);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Status
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.Status);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Source
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.Source);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Priority
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.Priority);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}

				public AggregateParameter Author
				{
					get
					{
							AggregateParameter ap = new AggregateParameter(NewsSchema.Author);
							this._clause._entity.Query.AddAggregateParameter(ap);
							return ap;
					}
				}


				private AggregateClause _clause;
			}
			#endregion
		
			public AggregateParameter NewsID
		    {
				get
		        {
					if(_NewsID_W == null)
	        	    {
						_NewsID_W = TearOff.NewsID;
					}
					return _NewsID_W;
				}
			}

			public AggregateParameter NewsTitle1
		    {
				get
		        {
					if(_NewsTitle1_W == null)
	        	    {
						_NewsTitle1_W = TearOff.NewsTitle1;
					}
					return _NewsTitle1_W;
				}
			}

			public AggregateParameter NewsTitle2
		    {
				get
		        {
					if(_NewsTitle2_W == null)
	        	    {
						_NewsTitle2_W = TearOff.NewsTitle2;
					}
					return _NewsTitle2_W;
				}
			}

			public AggregateParameter NewsTitle3
		    {
				get
		        {
					if(_NewsTitle3_W == null)
	        	    {
						_NewsTitle3_W = TearOff.NewsTitle3;
					}
					return _NewsTitle3_W;
				}
			}

			public AggregateParameter NewsCategoryID
		    {
				get
		        {
					if(_NewsCategoryID_W == null)
	        	    {
						_NewsCategoryID_W = TearOff.NewsCategoryID;
					}
					return _NewsCategoryID_W;
				}
			}

			public AggregateParameter Image
		    {
				get
		        {
					if(_Image_W == null)
	        	    {
						_Image_W = TearOff.Image;
					}
					return _Image_W;
				}
			}

			public AggregateParameter MainContent1
		    {
				get
		        {
					if(_MainContent1_W == null)
	        	    {
						_MainContent1_W = TearOff.MainContent1;
					}
					return _MainContent1_W;
				}
			}

			public AggregateParameter MainContent2
		    {
				get
		        {
					if(_MainContent2_W == null)
	        	    {
						_MainContent2_W = TearOff.MainContent2;
					}
					return _MainContent2_W;
				}
			}

			public AggregateParameter MainContent3
		    {
				get
		        {
					if(_MainContent3_W == null)
	        	    {
						_MainContent3_W = TearOff.MainContent3;
					}
					return _MainContent3_W;
				}
			}

			public AggregateParameter InitContent1
		    {
				get
		        {
					if(_InitContent1_W == null)
	        	    {
						_InitContent1_W = TearOff.InitContent1;
					}
					return _InitContent1_W;
				}
			}

			public AggregateParameter InitContent2
		    {
				get
		        {
					if(_InitContent2_W == null)
	        	    {
						_InitContent2_W = TearOff.InitContent2;
					}
					return _InitContent2_W;
				}
			}

			public AggregateParameter InitContent3
		    {
				get
		        {
					if(_InitContent3_W == null)
	        	    {
						_InitContent3_W = TearOff.InitContent3;
					}
					return _InitContent3_W;
				}
			}

			public AggregateParameter CreatedDate
		    {
				get
		        {
					if(_CreatedDate_W == null)
	        	    {
						_CreatedDate_W = TearOff.CreatedDate;
					}
					return _CreatedDate_W;
				}
			}

			public AggregateParameter Status
		    {
				get
		        {
					if(_Status_W == null)
	        	    {
						_Status_W = TearOff.Status;
					}
					return _Status_W;
				}
			}

			public AggregateParameter Source
		    {
				get
		        {
					if(_Source_W == null)
	        	    {
						_Source_W = TearOff.Source;
					}
					return _Source_W;
				}
			}

			public AggregateParameter Priority
		    {
				get
		        {
					if(_Priority_W == null)
	        	    {
						_Priority_W = TearOff.Priority;
					}
					return _Priority_W;
				}
			}

			public AggregateParameter Author
		    {
				get
		        {
					if(_Author_W == null)
	        	    {
						_Author_W = TearOff.Author;
					}
					return _Author_W;
				}
			}

			private AggregateParameter _NewsID_W = null;
			private AggregateParameter _NewsTitle1_W = null;
			private AggregateParameter _NewsTitle2_W = null;
			private AggregateParameter _NewsTitle3_W = null;
			private AggregateParameter _NewsCategoryID_W = null;
			private AggregateParameter _Image_W = null;
			private AggregateParameter _MainContent1_W = null;
			private AggregateParameter _MainContent2_W = null;
			private AggregateParameter _MainContent3_W = null;
			private AggregateParameter _InitContent1_W = null;
			private AggregateParameter _InitContent2_W = null;
			private AggregateParameter _InitContent3_W = null;
			private AggregateParameter _CreatedDate_W = null;
			private AggregateParameter _Status_W = null;
			private AggregateParameter _Source_W = null;
			private AggregateParameter _Priority_W = null;
			private AggregateParameter _Author_W = null;

			public void AggregateClauseReset()
			{
				_NewsID_W = null;
				_NewsTitle1_W = null;
				_NewsTitle2_W = null;
				_NewsTitle3_W = null;
				_NewsCategoryID_W = null;
				_Image_W = null;
				_MainContent1_W = null;
				_MainContent2_W = null;
				_MainContent3_W = null;
				_InitContent1_W = null;
				_InitContent2_W = null;
				_InitContent3_W = null;
				_CreatedDate_W = null;
				_Status_W = null;
				_Source_W = null;
				_Priority_W = null;
				_Author_W = null;

				this._entity.Query.FlushAggregateParameters();

			}
	
			private EasyObject _entity;
			private TearOffAggregateParameter _tearOff;
			
		}
	
		public AggregateClause Aggregate
		{
			get
			{
				if(_aggregateClause == null)
				{
					_aggregateClause = new AggregateClause(this);
				}
		
				return _aggregateClause;
			}
		}
		
		private AggregateClause _aggregateClause = null;	
		#endregion
	}
}
